<!DOCTYPE html>
<html>
<head>
<title>墨华体育论坛</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" media="screen"
href="./forumstyle.css">
<link rel="stylesheet" type="text/css" media="screen"
href="./forumstyle_.css">
</head>

<body>
<?php 
	$Email=$_POST["email"];
	$Username=$_POST["username"];
	$Password=$_POST["password1"];
	$Authority=0;
	echo "Welcome" . $Username; 
	echo "<br>";
	echo "Your email address is:" . $Email;
	echo "<br>";
	$host='localhost';
	$username='mohua';
	$password='mohua';
	$con = mysqli_connect($host,$username,$password);
	if (!$con)
		{
		die('Could not connect: '. mysql_error());
		}
	$DBname = 'mohuadb';
	$db_selected = mysqli_select_db($con,$DBname);
	if(!$db_selected)
		{
		die ("Cannot use mohuadb:" . mysql_error());
		}
	mysqli_query($con,"set names 'utf8'");
	$sql = "INSERT INTO user(uName,uPassword,Email,Authority) 
	VALUES ($Username,$Password,$Email,$Authority)";
	mysqli_query($con,$sql);

	$result = mysqli_query($con,"SELECT * FROM user");
	while($row = mysqli_fetch_array($result))
	{
		echo $row['uName'] ." ". $row['Email'];
		echo "<br>";
	}
	mysqli_close($con);
?>

</body>
</html>